#pragma once

#include <vector>
#include <string>
#include <iosfwd>

namespace NSpellCheck {

typedef std::vector<std::string> Phrase;

void parsePhrase(const std::string& string, Phrase* phrase);

struct Variation {
    double weight;
    Phrase phrase;
    Variation(double weight, const Phrase& phrase);
    Variation():
        weight(-1.0)
    {}
    bool operator<(const Variation& rhs) const {
        return weight < rhs.weight;
    }
};

struct ReverseVariationComparator {
    bool operator()(const Variation& v1, const Variation& v2) const {
        return v2 < v1;
    }
};

class ISpellChecker {
public:
    virtual ~ISpellChecker() { }
    virtual void process(const Phrase& phrase, std::vector<Variation>* suggestions) const = 0;
};

} // ns

std::ostream& operator<<(std::ostream& out, const NSpellCheck::Variation& variation);
std::ostream& operator<<(std::ostream& out, const NSpellCheck::Phrase& phrase);
